package bidsanity



import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
 */
@TestFor(CustomerService)
@Mock(Customer)
class CustomerServiceTests {

    void testCreateCustomer(){
        def cust = service.createCustomer(emailAddress: 'test@test.org', password: 'testing')
        Assert.assertNotNull(cust)
        Assert.assertNotNull(cust.id)
        Assert.assertFalse(cust.isAdmin)
        Assert.assertNotNull(cust.isAdmin)
        Assert.assertFalse(cust.hasErrors())
    }
    
    void testCreateBadCustomer(){
        def cust = service.createCustomer(emailAddress: 'bademail', password: 'testing')
        Assert.assertTrue(cust.hasErrors())
    }
}
